package scjp.preparation.generics;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Queue;

public class Test {
	

	public static void main(String[] args) {
		
//		List<Integer> l1 = new ArrayList<>();
//		l1.add(new Integer(1));
//		List l2 = l1;
//		l2.add("Hello");
//		List<Integer> l3 = l2;
//		l3.add(new Integer(2));
//		
//		List<Integer> l4 = l3.subList(0,2);
//		l4.add(0, 100);
//		System.out.println(l4);
		
//		Queue<Integer> q = new PriorityQueue<>(); 
//		for(int i = 0; i <=5; i++) {
//			q.add(i);
//			
//		}
//		System.out.println(q.poll());
//		System.out.println(q);
		
		List<A> l = new ArrayList<A>();
		
		l.add(new A("a1"));
		l.add(new A("m2"));
		l.add(new A("b5"));
		System.out.println(l);
		
	}

	
	
}

class A implements Comparator<A>{

	private String s;
	
	public A(String s) {
		this.s = s;
	}
	
	@Override
	public int compare(A arg0, A arg1) {
		// TODO Auto-generated method stub
		return arg0.s.compareTo(arg1.s);
	}

	public String getS() {
		return s;
	}

	public void setS(String s) {
		this.s = s;
	}

	@Override
	public String toString() {
		return "A [s=" + s + "]";
	}
	

	
}

class B implements Comparable<B>{

	@Override
	public int compareTo(B arg0) {
		// TODO Auto-generated method stub
		return 0;
	}
	
}